Skip to content

Conversation

@srikanthpadakanti
Copy link

Description

This pull request adds native support for the mvexpand command in PPL to OpenSearch SQL, enabling users to expand multivalue fields (arrays) into separate rows directly within queries. This functionality is analogous to Splunk's mvexpand command and streamlines analytics, dashboarding, and data preparation involving arrays or multivalue fields.

Key features introduced:

Native mvexpand command for PPL queries to expand array fields into separate rows/events.
Optional limit parameter to restrict the number of expanded values per event/document.
Robust handling of empty/null arrays, large arrays (with memory/resource limits), and non-array fields.
Streaming/distributable execution for performance and scalability.
Comprehensive documentation and edge case coverage.
This feature makes OpenSearch SQL more powerful and user-friendly for log analytics, data exploration, and migration from platforms like Splunk.

Related Issues

Resolves #4439
#4439

Check List

  • [ X] New functionality includes testing.
  • [ X] New functionality has been documented.
  • [ X] New functionality has javadoc added.
  • [ X] New functionality has a user manual doc added.
  • [ X] New PPL command checklist all confirmed.
  • [ X] API changes companion pull request created.
  • [ X] Commits are signed per the DCO using --signoff or -s.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Srikanth Padakanti and others added 9 commits October 27, 2025 10:44
Signed-off-by: Srikanth Padakanti <[email protected]>
Signed-off-by: Srikanth Padakanti <[email protected]>
Signed-off-by: Srikanth Padakanti <[email protected]>
Signed-off-by: Srikanth Padakanti <[email protected]>
Signed-off-by: Srikanth Padakanti <[email protected]>
Signed-off-by: Srikanth Padakanti <[email protected]>
Srikanth Padakanti added 2 commits November 3, 2025 13:00
Signed-off-by: Srikanth Padakanti <[email protected]>
Signed-off-by: Srikanth Padakanti <[email protected]>
@srikanthpadakanti
Copy link
Author

srikanthpadakanti commented Nov 3, 2025

Hello @dai-chen There are some tests failed in Security Plugin IT - unrelated to my mvexpand changes.
@ykmr1224

@ykmr1224
Copy link
Collaborator

ykmr1224 commented Nov 6, 2025

#4675 (comment)
From this comment, it looks like an improvement for existing expand command.
Why don't we improve expand at the same time, and consider mvexpand as and alias of expand?

@srikanthpadakanti
Copy link
Author

#4675 (comment) From this comment, it looks like an improvement for existing expand command. Why don't we improve expand at the same time, and consider mvexpand as and alias of expand?

Refactored as requested.
Improved the "expand" command and aliased the - "mvexpand" to it.

Signed-off-by: Srikanth Padakanti <[email protected]>
dai-chen
dai-chen previously approved these changes Nov 11, 2025
Copy link
Collaborator

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

Signed-off-by: Srikanth Padakanti <[email protected]>
Srikanth Padakanti added 2 commits November 13, 2025 17:39
Signed-off-by: Srikanth Padakanti <[email protected]>
Signed-off-by: Srikanth Padakanti <[email protected]>
Signed-off-by: Srikanth Padakanti <[email protected]>
@dai-chen
Copy link
Collaborator

Please check CI failure.

@srikanthpadakanti
Copy link
Author

Please check CI failure.

@dai-chen The CI failures are not related to mvexpand. I merged the upstream changes to. my main. CI failure is pointing to -
testMvindexSingleElementPositive, testMvindexSingleElementNegative, testMvindexRangePositive, testMvindexRangeNegative in CalcitePPLArrayFunctionTest.
The assertion failures are string-equality checks of generated SQL (PPL → SparkSQL text). The RelNode / logical plan printed in the local run shows ITEM(...) and ARRAY_SLICE(...) expressions — i.e. the array functions are present and being produced, but the exact string formatting (parentheses, unary +/-, expression grouping) differs from the test expectation used in CI.

My local run shows those tests pass. But, CI failed. That implies either:
A difference in environment (JDK/OS/Calcite pretty-printer) between my local and CI, or
Different code in CI (different branch/commit or cached build) than my local, or
Tests were updated in one place and translator/pretty printing in another.method in CalcitePPLArrayFunctionTest. @ahkcs Can you please confirm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PPL Piped processing language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add native support for mvexpand command in PPL

3 participants